package wwwContinent;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class ServletDemo02 extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println(getServletContext().getInitParameter("city"));
        System.out.println(getServletContext().getAttribute("sweetheart"));
        System.out.println(getServletContext().getAttribute("被选召的孩子"));
        System.out.println(getServletContext().getAttribute("city"));
        System.out.println(getServletContext().getInitParameter("city"));
        getServletContext().removeAttribute("city");
        System.out.println(getServletContext().getAttribute("city"));
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
